package com.demo.user.annconfig.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.demo.user.annconfig.dao.UserDAO;

public class UserServiceImpl implements UserService {
	
	// @Resource 默认按照名称装配，如果找不到按照类型装配，如果指定装配名称只能按照名称装配
	
	// @Resource(name = "dao12")
	
	@Autowired // 默认按照类型装配，如果指定装配名称只能按照名称装配
	@Qualifier("dao12")
	private UserDAO dao;
	
	public UserServiceImpl() {
		System.out.println("service-instance");
	}
	
	/* (non-Javadoc)
	 * @see com.demo.user.service.UserService#saveUser()
	 */
	@Override
	public void saveUser() {
		dao.addUser();
	}
}
